<template>
	<div class="hy-container">
		<div class="content_box">
			<HyTable
				:searchFields="searchFields"
				:searchConfig="searchConfig"
				:searchDefault="searchDefault"
				:tableConfig="tableConfig"
				:tableColumns="tableColumns"
				ref="hyTableRef"
				:buttonConfig="{
					span: 4,
					offset: 1,
				}"
			>
				<template #operation>
					<el-table-column fixed="right" label="操作" width="180">
						<template #default="{ row }">
							<div class="flex flex-col justify-center">
								<el-button text type="primary" icon="EditPen" @click="scoreing(row)">进行评价</el-button>
								<el-button class="my-3" text type="primary" icon="View" @click="goMeeting(row)">查看会议内容</el-button>
								<el-button text type="primary" icon="View" @click="goExpert(row)">查看专家数据</el-button>
							</div>
						</template>
					</el-table-column>
				</template>
			</HyTable>
		</div>

		<!-- 进行评价 -->
		<expertsRev :listId="listId" ref="expertsRevRef" />
	</div>
</template>

<script lang="ts" setup>
import HyTable from '/@/components/HyTable/index.vue';
import expertsRev from './components/expertsRev.vue';
import { searchEvaluatedList } from '/@/api/expertDatabase/evaluate';
import { ArrowDown, Document, Edit, Delete, Reading } from '@element-plus/icons-vue';
import { ElMessageBox } from 'element-plus';

const tableColumns = computed(() => {
	return [
		{ prop: 'reviewUserName', label: '评审专家' },
		{ prop: 'reviewUserPhone', label: ' 联系方式' },
		{ prop: 'meetingName', label: '会议名称' },
		{ prop: 'reviewAppStr', label: '评审项目' },
		{ prop: 'reviewAddress', label: '评审地点' },
		{ prop: 'reviewTime', label: '评审时间' },
	];
});
const tableConfig = computed(() => {
	return {
		request: searchEvaluatedList,
	};
});
// 配置搜索
const searchFields = computed(() => {
	return {
		keyword: {
			type: 'input',
			label: '评审项目',
		},
	};
});
const searchConfig = computed(() => {
	return {
		labelWidth: '120px',
		span: 6,
		offset: 0,
		type: 'search',
		title: '待评价管理',
		show: true,
	};
});
//传入额外参数
const searchDefault = ref({
	type: 0,
});

//操作
const router = useRouter();
const hyTableRef = ref();
const expertsRevRef = ref();

//进行评价
const listId: any = ref('');
const scoreing = (row: any) => {
	listId.value = row.id;
	expertsRevRef.value.dialogVisible = true;
};
//查看会议内容
const goMeeting = (row: any) => {
	router.push({
		path: '/expertDatabase/extract/operate',
		query: {
			operateType: 'view',
			id: row?.reviewMeetingId || '',
		},
	});
};
//查看专家数据
const goExpert = (row: any) => {
	router.push({
		path: '/expertDatabase/expert/operate/index',
		query: {
			operateType: 'view',
			expertInfoId: row.reviewUserId,
			status: '',
		},
	});
};
</script>
<style scoped lang="scss">
.content_box {
	// :deep(.el-form--default) {
	// 	justify-content: flex-end;
	// }
	// :deep(.el-form--default > div) {
	// 	margin-left: 30px !important;
	// }
}
</style>
